<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../css/element.css" rel="stylesheet"/>
    <link href="../css/styleindex.css" rel="stylesheet"/>
    <style>

    </style>
</head>
<body style="background:#EFF0F4;">

  <div class="mui-content">
    <div id="vm" class="x-examok" v-cloak>
      <div class="x-header-g" id="header">
        <a class="x-header-arrow" @click="api.closeWin()"></a>
        <div class="x-header-t">查看日记</div>
      </div>
      <div class="x-pro-list">
        <div class="x-pro-row">
          <div class="x-pro-label">记录时间:</div>
          <div class="x-pro-input">
            {{input1}}
          </div>
        </div>
        <div class="x-pro-row">
          <div class="x-pro-label">门店:</div>
          <div class="x-pro-input">
            {{input2}}
          </div>
        </div>
        <div class="x-pro-row">
          <div class="x-pro-label">职务:</div>
          <div class="x-pro-input">
            {{input3}}
          </div>
        </div>
        <div class="x-pro-row">
          <div class="x-pro-label">是否同意分享:</div>
          <div class="x-pro-input">
            <el-switch v-model="input4" disabled  active-color="#13ce66" inactive-color="#cccccc"></el-switch>
          </div>
        </div>
      </div>
      <div class="x-pro-list">
        <div class="x-pro-row">
          <div class="x-pro-label">标题:</div>
          <div class="x-pro-input">
            {{title}}
          </div>
        </div>
        <div class="x-pro-row">
          <div class="x-pro-label">内容:</div>
          <div class="x-pro-input">
            {{content}}
          </div>
        </div>
      </div>
      <!--  -->
      <div v-show="nolike">
        <div class="x-pro-gobtn" v-if="isgo>0">已推荐</div>
        <div class="x-pro-gobtn x-disabled" v-else @click="isok">推荐</div>
      </div>
      
    </div>
  </div>

  <script type="text/javascript" src="../script/vue.js"></script>
  <script type="text/javascript" src="../script/element.js"></script>
  <script type="text/javascript" src="../script/api.js"></script>
  <script type="text/javascript" src="../script/base.js"></script>
	<script>
apiready = function () {
    $api.fixStatusBar($api.byId('header'));
    var tid = api.pageParam.id;
    var tnolike = api.pageParam.nolike;
    console.log(tid);

    //
    var vm = new Vue({
      el:'#vm',
      data(){
        return{
          thid:'',
          input1:'',
          input2:'',
          input3:'',
          input4:'',
          title:'',
          content:'',
          isgo:'',
          thnolike:'',
          nolike:true,
        }
      },
      created:function() {
        var that=this;


      },
      mounted:function(){
        var that=this;
        that.thid = tid;
        thnolike = tnolike;
        if(thnolike=='nolike'){
          that.nolike = false;
        }
        that.getdata()

      },
      methods: {
        getdata:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/note/view',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                id:that.thid,
                _ssid:$api.getStorage('jobid')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                that.input1 = ret.data.in_date;
                that.input2 = ret.data.shop_title;
                that.input3 = ret.data.job_title;
                if(ret.data.is_share=='1'){
                  that.isshare = true;
                }else{
                  that.isshare = false;
                }
                that.title = ret.data.title;
                that.content = ret.data.content;
                that.isgo = ret.data.like_memberid;


              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        isok:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/note/like',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                id:that.thid,
                _ssid:$api.getStorage('jobid')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                api.alert({
                    title: '推荐成功',
                    msg: '',
                }, function(ret, err) {
                  
                });

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
      }
    })
	}


	</script>
</body>
</html>
